home *** CD-ROM | disk | FTP | other *** search
- #include <string.h>
- #include <stdlib.h>
- #include <support.h>
- #include "extras.h"
-
- char *pfindfile(path, afn, ext)
- const char *path, *afn, *ext;
- {
- register char * const *ext_list;
- register const char *x;
- register int n_ext, i;
- char *retval;
-
- if (!ext)
- return findfile(afn, path, (char * const *)0);
-
- for (n_ext = 0, x = ext; *x; n_ext++, x += strlen(x) + 1)
- continue;
- ext_list = (char * const *)malloc((n_ext + 1) * sizeof(const char *));
- for (i = 0, x = ext; i < n_ext; i++, x += strlen(x) + 1) {
- if (*x =='.')
- ext_list[i] = x + 1;
- else
- ext_list[i] = x;
- }
- ext_list[n_ext] = 0;
-
- retval = findfile(afn, path, ext_list);
- free(ext_list);
- return retval;
- }
-